<section id="main-content">
  <section class="wrapper">
    <!--state overview end-->
    <div class="row">
      <div class="col-lg-12">
        <section class="panel">
          <header class="panel-heading">
            出差申请信息
          </header>
          <div class="panel-body">
            <div class="bio-row">
              <p>
                <span>类型</span>{{type}}</p>
            </div>
            <div class="bio-row">
              <p>
                <span>出差单号</span>{{tripNum}}</p>
            </div>
            <div class="bio-row">
              <p>
                <span>申请人</span>{{userName}}</p>
            </div>
            <div class="bio-row">
              <p>
                <span>出差开始时间</span>{{planStime | date:'yyyy-MM-dd HH:mm:ss'}}</p>
            </div>
            <div class="bio-row">
              <p>
                <span>出差结束时间</span>{{planEtime | date:'yyyy-MM-dd HH:mm:ss'}}
              </p>
            </div>
            <div class="bio-row">
              <p>
                <span>预测总费用</span>￥{{spMoney}}元
              </p>
            </div>
            <!--<div class="bio-row">-->
            <!--<p>-->
            <!--<span>出差说明</span>￥{{tripComments}}-->
            <!--</p>-->
            <!--</div>-->
          </div>
        </section>
        <section class="panel">
          <header class="panel-heading">
            出差预测费用明细
          </header>
          <div class="panel-body">
            <div class="bio-row" ng-repeat="x in bugets">
              <p>
                <span>{{x.bugetType}}</span>￥{{x.buget}}元
              </p>
            </div>
          </div>
        </section>
        <section class="panel hdoabtmeg" style="display: none;">
          <input type="hidden" value="{{sproId}}" id="proId"/>
          <input type="hidden" value="{{aid}}" id="appId">
          <header class="panel-heading">
            工作计划与结果
          </header>
          <div class="panel-body">
            <div class="bio-row">
              <p>
                <span>归属项目</span>{{sproName}}
              </p>
            </div>
            <div class="bio-row">
              <p>
                <span>计划开始时间</span>{{splanStarTime|date:'yyyy-MM-dd HH:mm:ss'}}
              </p>
            </div>
            <div class="bio-row">
              <p>
                <span>计划结束时间</span>{{splanEndTime|date:'yyyy-MM-dd HH:mm:ss'}}
              </p>
            </div>
            <div class="bio-row">
              <p>
                <span>地点</span>{{splanCity}}
              </p>
            </div>
            <div class="bio-row line-row">
              <p>工作计划</p>
              <p>{{splanComments}}</p>
            </div>
            <div class="form-group customerForm">
              <label class="col-sm-2 control-label">实际计划开始时间<span>*</span></label>
              <div class="col-sm-4">
                <input type="text" value="" id="startTime" disabled class="form-control">
              </div>
              <label class="col-sm-2 control-label">实际计划结束时间<span>*</span></label>
              <div class="col-sm-4">
                <input type="text" value="" id="endTime" disabled class="form-control">
              </div>
            </div>
            <div class="form-group customerForm">
              <label class="col-sm-2 control-label">工作结果<span>*</span></label>
              <div class="col-sm-10">
                <textarea class="form-control" id="planResult" maxlength="500" disabled placeholder="是否完成计划内容，具体完成情况如何？"></textarea>
              </div>
            </div>
            <p class="default-buttons">
              <a href="javascript:void(0);" class="button-back btn btn-info" onclick="hdoabtmeg();">取消</a>
              <!--<a href="javascript:void(0);" class="button-next  btn btn-info tj">提交</a>-->
            </p>
          </div>
        </section>
        <section class="panel">
          <div class="panel-heading">
            实际出差时间
          </div>
          <div class="panel-body">
            <div class="form-group customerForm">
              <label class="col-sm-2 control-label">实际出差开始时间<span>*</span></label>
              <div class="col-sm-4">
                <input type="text" value="{{actualAplStarTime|date:'yyyy-MM-dd HH:mm:ss'}}" id="actualAplStarTime" disabled class="form-control">
              </div>
              <label class="col-sm-2 control-label">实际出差结束时间<span>*</span></label>
              <div class="col-sm-4">
                <input type="text" value="{{actualAplEndTime|date:'yyyy-MM-dd HH:mm:ss'}}" id="actualAplEndTime" disabled class="form-control">
              </div>
            </div>
          </div>
          <header class="panel-heading">
            出差计划与结果
          </header>
          <div class="panel-body">
            <div id="oabt2Container" class="dlshouwen-grid-container"></div>
          </div>
        </section>
        <section class="panel">
            <div class="panel-body">
                <p class="default-buttons">
                    <a href="javascript:void(0);" class="button-back btn btn-info" onclick="window.history.back()">返回</a>
                    <a href="javascript:void(0);" class="button-next  btn btn-info" onclick="window.history.back()">确认</a>
                </p>
            </div>
        </section>

        <!--流程star-->
        <section>
          <a href="javascript:void(0);" class="second" id="process" onclick="shaper();">
            流程跟踪
          </a>
        </section>
        <!-- 流程跟踪展示效果 -->
        <section class="hdaper">
          <div class="panel">
            <div class="panel-heading add-heading">
              流程跟踪
              <i class="add-icon icon-remove" href="javascript:$.pageslide.close()" onclick="hdaper();"></i>
            </div>
            <div class="panel-body panel-proce">
              <div class="proce-middle" id="nodeContiner"></div>
            </div>
          </div>
          <div class="paper-bg"  onclick="clsbox();"></div>
        </section>
        <!--流程end-->
      </div>
    </div>
  </section>
</section>
<script type="text/javascript">
    var stepId = $CertusJsonAjax.getStepInstanceId();
    var processId = $CertusJsonAjax.getProInstanceId();
    $CertusFormAjax.ajax('findWaitInfo',{"processId":processId},function (response) {
        var data = response.data.appInfo;
        $$scope.id = data.id;
        $$scope.tripNum = data.trip_num;
        $$scope.userName = data.user_name;
        $$scope.planStime = data.trip_star_time;
        $$scope.planEtime = data.trip_end_time;
        // $$scope.tripComments = data.trip_comments;
        var bugetInfo = response.data.bugetInfo;
        $$scope.spMoney = 0;
        for (var i=0;i<bugetInfo.length;i++){
            if (bugetInfo[i].status==1){
                $$scope.spMoney = bugetInfo[i].buget;
            }
        }
        $$scope.actualAplStarTime = data.actual_trip_time;
        $$scope.actualAplEndTime = data.actual_end_time;
        if(data.type==1){
            $$scope.type ="出差";
        }else{
            $$scope.type ="公干";
        }
    });

    loadTriplb();
    var yzData = [];
    function loadTriplb() {
        $CertusFormAjax.ajax('findTripPlans2',{"processId":processId},function (response) {
            var data = response.data;
            yzData = data;
            // 出差计划
            var oabtColumns = [{
                id: 'pro_name',
                title: '归属项目',
                type: 'stri1ng',
                columnClass: 'text-center',
            }, {
                id: 'plan_star_time',
                title: '计划开始时间',
                type: 'date',
                format:'yyyy-MM-dd hh:mm:ss',
                otype:'time_stamp_ms',
                columnClass: 'text-center',
            }, {
                id: 'plan_end_time',
                title: '计划结束时间',
                type: 'date',
                format:'yyyy-MM-dd hh:mm:ss',
                otype:'time_stamp_ms',
                columnClass: 'text-center',
            }, {
                id: 'plan_city',
                title: '地点',
                type: 'string',
                columnClass: 'text-center',
            }, {
                id: 'plan_comments',
                title: '工作计划',
                type: 'string',
                columnClass: 'text-center',
            },{
                id: 'actual_star_time',
                title: '实际开始时间',
                type: 'date',
                format:'yyyy-MM-dd',
                otype:'time_stamp_ms',
                columnClass: 'text-center',
                resolution:function (value, record){
                    var content="";
                    if (record.actual_star_time!=null){
                        var date = new Date(record.actual_star_time)
                        content = $.fn.dlshouwen.grid.tools.dateFormat(date, "yyyy-MM-dd hh:mm:ss");
                    }
                    return content;
                }
            }, {
                id: 'actual_end_time',
                title: '实际结束时间',
                type: 'date',
                format:'yyyy-MM-dd',
                otype:'time_stamp_ms',
                columnClass: 'text-center',
                resolution:function (value, record){
                    var content="";
                    if (record.actual_end_time!=null){
                        var date = new Date(record.actual_end_time)
                        content = $.fn.dlshouwen.grid.tools.dateFormat(date, "yyyy-MM-dd hh:mm:ss");
                    }
                    return content;
                }
            },{
                id: 'trip_result',
                title: '出差结果',
                type: 'string',
                columnClass: 'text-center',
            }];
            $("#oabt2Container").empty();
            var oabtOption = {
                lang: 'zh-cn',
                ajaxLoad: false,
                // loadURL:'url',
                exportFileName: '出差计划',
                datas: data,
                columns: oabtColumns,
                gridContainer: 'oabt2Container',
                tools: '',
            };
            var oabtGrid = $.fn.dlshouwen.grid.init(oabtOption);
            oabtGrid.load();
        });
    }
</script>
<script src="js/trip/tripNodeMain.js"></script>